﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ExtractFiles
{
    public partial class HowToSearchContent : HowtoParent
    {
        private int currentPage = 1;
        private int firstPage = 2;
        private int maxPage = 9;

        public HowToSearchContent()
        {
            InitializeComponent();
        }

        protected override void howToSearchFilesPrevBtn_Click(object sender, EventArgs e)
        {
            if (currentPage == firstPage)
            {
                displayFirstPageControls();
            }
            else
            {
                displayNormalPageControls();
            }
            currentPage -= 1;
            displayPage();
        }

        protected override void howToSearchFilesNextBtn_Click(object sender, EventArgs e)
        {
            if (currentPage == maxPage)
            {
                displayLastPageControls();
            }
            else
            {
                displayNormalPageControls();
            }
            currentPage += 1;
            displayPage();
        }

        protected override void displayPage()
        {
            switch (currentPage)
            {
                case 1:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Select \"Search Content\" tab";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchcontenttab;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Select the \"Search Content\" tab to search for particular content in multiple files.\n\nClick \"Next\" to continue.";
                    break;
                case 2:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Browse for source directory";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchcontentsrcdir;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Browse for the directory which contains the files including those that may contain the content that you would like to search for.\n\nClick \"Next\" to continue.";
                    break;
                case 3:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Browse for file to store result";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchcontentdestfile;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Browse for the file where you wish to store the list of search results. The file must be created first to be selected.\n\nClick \"Next\" to continue.";
                    break;
                case 4:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Set the source file type - .txt";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchcontenttxtfiletype;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Indicate the file type to search for. Select .txt for text files.\n\nClick \"Next\" to continue.";
                    break;
                case 5:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Set the search pattern";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchcontenttxtcontainsstr;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Set the string pattern(s) to search for in the files. Deliminate each pattern with a comma (,), so do not include a comma in the pattern itself.\n\nClick \"Next\" to continue.";
                    break;
                case 6:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Set the source file type - .xml";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchcontentxmlfiletype;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Alternatively, you may also search in XML files. Select .xml for XML files.\n\nClick \"Next\" to continue.";
                    break;
                case 7:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Set search type";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchcontentxmlsearchbyopt;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": In XML files, you can perform search either by the element ID or element name.\n\nClick \"Next\" to continue.";
                    break;
                case 8:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Search by string patterns";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchcontentxmlsearchbystr;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Whether you search by ID or name, you can set the search string pattern(s) for either type. Deliminate each pattern with a comma (,), so do not include a comma in the pattern itself.\n\nClick \"Next\" to continue.";
                    break;
                case 9:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Set the search pattern";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchcontentxmlcontainsstr;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Set the string pattern(s) to search for in the files. Deliminate each pattern with a comma (,), so do not include a comma in the pattern itself.\n\nClick \"Next\" to continue.";
                    break;
                case 10:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Search now!";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchcontentsearchbtn;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Click the \"Search\" button and a list of result will be populated in the list box above.";
                    break;
            }
        }
    }
}
